package grape.crm.service.customerbelong.api;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import grape.crm.service.customerbelong.po.CustomerBelong;
import grape.common.service.common.IBaseService;

/**
 * <p>
 * 客户归属表 服务类
 * </p>
 *
 * @author yangwei
 * @since 2020-09-14
 */
public interface ICustomerBelongService extends IBaseService<CustomerBelong> {

    /**
     * 根据客户id查询
     * @param customerId 必填
     * @return
     */
    default CustomerBelong getByCustomerId(String customerId) {
        assertParamNotEmpty(customerId,"customerId不能为空");
        return getOne(Wrappers.<CustomerBelong>lambdaQuery().eq(CustomerBelong::getCustomerId, customerId));
    }

    /**
     * 设置依赖用户属性
     * @param entity
     * @return
     */
    public CustomerBelong setAttrForUpdateOrInsert(CustomerBelong entity);
}
